
package com.cmsz.paydemo.util;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

/**
 * 
 * @TODO ADD REASON
 * @Date 2017年4月28日 下午3:54:11
 * @author Edison_lv
 * @version
 */
public class FileUtil {

	public static String getData(String fileName) {
		String str = null;
		ClassLoader classLoader = new FileUtil().getClass().getClassLoader();
		File file = new File(classLoader.getResource(fileName).getFile());
		try {
			str = FileUtils.readFileToString(file, "UTF-8");
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}
	
	
	public static File getFile(String fileName) {
		ClassLoader classLoader = new FileUtil().getClass().getClassLoader();
		File file = new File(classLoader.getResource(fileName).getFile());
		return file;
	}
}
